import { createRouter, createWebHistory } from 'vue-router';

// 引入组件
import IndexHome from '../components/IndexHome.vue';
import LoginPage from '../components/LoginPage.vue'
// 定义路由
const routes = [
  {
    path: '/', component: IndexHome, meta: {
      requireAuth: true
    }
  },

  {
    path: '/IndexHome', component:()=> import('../components/IndexHome.vue'),
    children: [
      {
        path: 'homePage',
        name: 'homePage',
        component:()=> import('@/components/home/homePage.vue'), meta: {
          requireAuth: true
        }
      },
      {
        path: 'userList',
        name: 'userList',
        component: ()=>import('@/components/adminUser/userList.vue'), meta: {
          requireAuth: true
        }
      },
      {
        path: 'roleList',
        name: 'roleList',
        component: ()=>import('@/components/rolePower/roleList.vue'), meta: {
          requireAuth: true
        }
      },
      {
        path: 'powerList',
        name: 'powerList',
        component: ()=>import('@/components/rolePower/powerList.vue'), meta: {
          requireAuth: true
        }
      },
      {
        path: 'wechatMenuList',
        name: 'wechatMenuList',
        component: ()=>import('@/components/wechat/menuList.vue'), meta: {
          requireAuth: true
        }
      },
      {
        path: 'wordList',
        name: 'wordList',
        component: ()=>import('@/components/keyWord/wordList.vue'), meta: {
          requireAuth: true
        }
      },
      {
        path: 'wordType',
        name: 'wordType',
        component: ()=>import('@/components/keyWord/typeList.vue'), meta: {
          requireAuth: true
        }
      }

    ], meta: {
      requireAuth: true
    }
  },
  {
    path: '/LoginPage',
    name: 'LoginPage',
    component: () => LoginPage,
    meta: { title: "登录" }
  }
];

// 创建router实例
const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;